package com.zhouyu.service;

import org.springframework.context.SmartLifecycle;
import org.springframework.stereotype.Component;

@Component
public class MySmartLifecycle implements SmartLifecycle {

	private boolean isRunning;

	@Override
	public void start() {
		isRunning = true;
		System.out.println("MySmartLifecycle start");
	}

	@Override
	public void stop() {
		isRunning = false;
		System.out.println("MySmartLifecycle stop");
	}

	@Override
	public boolean isRunning() {
		System.out.println("MySmartLifecycle isRunning:" + isRunning);
		return isRunning;
	}
}
